
// A temp spawn deployable..
$Sentinel::DepSpawnLimit = 1;

//------------------------------------------------------------------------------
//                          Looping Spawn

datablock StaticShapeData(SentSpawn) : DeployedCrate
{
	shapeFile = "stackable4l.dts";
};

function ccMakeSpawn(%sender, %args)
{
  %pos        = %sender.player.getEyePoint();
  %vec        = %sender.player.getEyeVector();
  %targetpos  = vectoradd(%pos,vectorscale(%vec,100));
  %Raw_data   = containerraycast(%pos,%targetpos,$typemasks::TerrainObjectType, %sender.player);
  %pos        = getwords(%Raw_data, 1, 3);


 %spawn = new StaticShape()
 {
   Datablock = SentSpawn; // SentSpawn is a temp
   Position = %pos;
   team = %sender.team;
   Units = 0;
   scale = "1 1 0.1";
 };
 missionCleanup.Add(%spawn);

 %spawn.GetDatablock().SpawnLoop(%spawn);

}

// just a little function that lays out how a Zombie-Spawn like deployable would plugin
function SentSpawn::SpawnLoop(%this, %spawn)
{
 if (%spawn.Units < $Sentinel::DepSpawnLimit)
 {
   if (isObject(%spawn))
   {
     %pos = VectorAdd(%spawn.GetPosition(), "0 0 1");

     %spawn.Units++;

     SentinelCreate(%spawn.team, %pos, %spawn);

     %this.Schedule(10*1000, "SpawnLoop", %spawn);
   }
 }

 return;
}


